random mac address c#

91

random mac address c# -

public static string GetRandomMacAddress()
{
    var random = new Random();
    var buffer = new byte[6];
    random.NextBytes(buffer);
    var result = String.Concat(buffer.Select(x => string.Format("{0}:", x.ToString("X2"))).ToArray());
    return result.TrimEnd(':');
}

Comments

Submit
0 Comments